var OSS = require('ali-oss')

export function client() {
  var client = new OSS({
    region: 'oss-cn-shenzhen',
    accessKeyId: 'LTAIqe9k1kpr5gQT',
    accessKeySecret: 'iwGDzruuECj2FZdPUhTqlFuNlLdruT',
    bucket: 'qianxunzhimei'
  })
  return client
}

/**
 * 生成随机文件名称
 * 规则八位随机字符，加下划线连接时间戳
 */
export const getFileNameUUID = () => {
  function rx() {
    return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
  }
  return `${+new Date()}_${rx()}${rx()}`
}
